export default {
  set(key: string, val: any): void {
    localStorage.setItem(key, JSON.stringify(val))
  },
  get(key: string): any {
    const val = localStorage.getItem(key)
    if (!val) return ''
    try {
      return JSON.parse(val)
    } catch {
      return val
    }
  },
  remove(key: string): void {
    localStorage.removeItem(key)
  },
  clear(): void {
    localStorage.clear()
  }
}
